package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.dnd.*;
	import org.aswing.event.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	import org.aswing.plaf.*;
	import org.aswing.skinbuilder.*;
	public class FrameFaction extends JFrame
	{
		//members define
		private var panel24:JPanel;
		private var btn_faction_tab_rank:JToggleButton;
		private var btn_faction_tab_mine:JToggleButton;
		private var btn_faction_create_faction:JButton;
		private var panelBottom:JPanel;
		
		//----------------------
		
		private var panelBottomRank:PaneFactionBRank;
		private var panelBottomMine:PaneFactionBMine;
		private var btn_close:JButton;
		public function FrameFaction()
		{
			setClosable(false);
			setResizable(false);  
			setBorder(new EmptyBorder());
			btn_close = new JButton();
			//btn_close.setLocation(new IntPoint(453, 8));
			btn_close.setSize(new IntDimension(27, 27));
			btn_close.setPreferredSize(new IntDimension(27, 27));
			this.getTitleBar().setCloseButton(btn_close);
			this.getTitleBar().setMinimizeHeight(32);
			this.setClipMasked(false);
			
			//component creation
			setSize(new IntDimension(442, 351));
			setPreferredSize(new IntDimension(442, 351));
			var layout0:EmptyLayout = new EmptyLayout();
			getContentPane().setLayout(layout0);
			
			panel24 = new JPanel();
			panel24.setLocation(new IntPoint(0, 3));
			panel24.setSize(new IntDimension(442, 25));
			panel24.setPreferredSize(new IntDimension(442, 25));
			var layout1:EmptyLayout = new EmptyLayout();
			panel24.setLayout(layout1);
			
			btn_faction_tab_rank = new JToggleButton();
			btn_faction_tab_rank.setLocation(new IntPoint(12, -3));
			btn_faction_tab_rank.setSize(new IntDimension(81, 28));
			btn_faction_tab_rank.setPreferredSize(new IntDimension(81, 28));
			btn_faction_tab_rank.setText("label");
			
			btn_faction_tab_mine = new JToggleButton();
			btn_faction_tab_mine.setLocation(new IntPoint(94, -3));
			btn_faction_tab_mine.setSize(new IntDimension(81, 28));
			btn_faction_tab_mine.setPreferredSize(new IntDimension(81, 28));
			btn_faction_tab_mine.setText("label");
			
			btn_faction_create_faction = new JButton();
			btn_faction_create_faction.setLocation(new IntPoint(362, 1));
			btn_faction_create_faction.setSize(new IntDimension(73, 24));
			btn_faction_create_faction.setPreferredSize(new IntDimension(73, 24));
			btn_faction_create_faction.setText("label");
			
			panelBottom = new JPanel();
			panelBottom.setLocation(new IntPoint(8, 30));
			panelBottom.setSize(new IntDimension(425, 308));
			panelBottom.setPreferredSize(new IntDimension(425, 308));
			
			//component layoution
			getContentPane().append(panel24);
			//append(panelBottom);
			
			panel24.append(btn_faction_tab_rank);
			panel24.append(btn_faction_tab_mine);
			panel24.append(btn_faction_create_faction);
			
			//-------------------
			
			panelBottomRank = new PaneFactionBRank();
			panelBottomRank.setLocation(new IntPoint(8, 30));
			panelBottomRank.setSize(new IntDimension(425, 308));
			panelBottomRank.setPreferredSize(new IntDimension(425, 308));
			
			panelBottomMine = new PaneFactionBMine();
			panelBottomMine.setLocation(new IntPoint(8, 30));
			panelBottomMine.setSize(new IntDimension(425, 308));
			panelBottomMine.setPreferredSize(new IntDimension(425, 308));
			
			
			panelBottom = panelBottomRank;
			
			getContentPane().append(panelBottom);
			
			panel24.setClipMasked(false);
			btn_faction_tab_rank.setClipMasked(false);
			btn_faction_tab_mine.setClipMasked(false);
			setImages();
			getContentPane().setClipMasked(false);
			setClipMasked(false);
			panelBottomMine.setClipMasked(false);
		}
		private var img_faction_rank_bg:AssetBackground = null;
		public var img_faction_pandect_bg:AssetBackground = null;
		public var img_faction_members_bg:AssetBackground = null;
		public var img_faction_trends_bg:AssetBackground = null;
		public var img_faction_applicant_bg:AssetBackground = null;
		public function setImages():void
		{
			img_faction_pandect_bg = new AssetBackground(Client.getUIElement("img_faction_pandect_bg") as DisplayObject);
			img_faction_members_bg = new AssetBackground(Client.getUIElement("img_faction_members_bg") as DisplayObject);
			img_faction_trends_bg = new AssetBackground(Client.getUIElement("img_faction_trends_bg") as DisplayObject);
			img_faction_applicant_bg = new AssetBackground(Client.getUIElement("img_faction_applicant_bg") as DisplayObject);
			
			var img_char_background:DisplayObject = Client.getUIElement("img_faction_rank_bg") as DisplayObject
			img_faction_rank_bg = new AssetBackground(img_char_background);
			setBackgroundDecorator(img_faction_rank_bg);
			setSizeWH(img_char_background.width,img_char_background.height);
			setLocationXY((Engine.W - img_char_background.width) / 2,(Engine.H - img_char_background.height)/2);
			btn_close.wrapSimpleButton(Client.getUIElement("btn_close") as SimpleButton);
			
			btn_faction_create_faction.wrapSimpleButton(Client.getUIElement("btn_faction_create_faction") as SimpleButton);
			btn_faction_create_faction.setText("");
			
			btn_faction_tab_rank.wrapSimpleButton(Client.getUIElement("btn_faction_tab_rank") as SimpleButton);
			btn_faction_tab_rank.setText("");
			btn_faction_tab_mine.wrapSimpleButton(Client.getUIElement("btn_faction_tab_mine") as SimpleButton);
			btn_faction_tab_mine.setText("");
			btn_faction_tab_rank.setSelected(true);
			var group:ButtonGroup = new ButtonGroup();
			group.appendAll(btn_faction_tab_rank,btn_faction_tab_mine);
			
			btn_faction_tab_rank.addActionListener(onBtnTabRank);
			btn_faction_tab_mine.addActionListener(onBtnTabMine);
			btn_faction_create_faction.addActionListener(onBtnCreate);
			
		}
		private function onBtnTabRank(e:Event):void
		{
			if(getBackgroundDecorator() != img_faction_rank_bg)
				setBackgroundDecorator(img_faction_rank_bg);
			if(panelBottom != panelBottomRank)
			{
				getContentPane().remove(panelBottom);
				panelBottom = panelBottomRank;
				getContentPane().append(panelBottom);
			}
			update();
			paintImmediately();
		}
		public function init():void
		{
			if(!isInFaction() && btn_faction_tab_mine.isEnabled())
			{
				btn_faction_tab_rank.setSelected(true);
				btn_faction_tab_mine.setSelected(false);
				onBtnTabRank(null);
			}
			btn_faction_tab_mine.setEnabled(isInFaction());
			update();
		}
		public function update():void
		{
			if(panelBottom == panelBottomRank)
				panelBottomRank.update();
			if(panelBottom == panelBottomMine)
				panelBottomMine.update();
		}
		private function onBtnTabMine(e:Event):void
		{
			if(getBackgroundDecorator() != img_faction_pandect_bg)
				setBackgroundDecorator(img_faction_pandect_bg);
			if(panelBottom != panelBottomMine)
			{
				getContentPane().remove(panelBottom);
				panelBottom = panelBottomMine;
				getContentPane().append(panelBottom);
			}
			update();
			panelBottomMine.init();
			paintImmediately();
		}
		public static function getJobName(job:int):String
		{
			if(job == 0) return "帮众";
			if(job == 1) return "精英";
			if(job == 2) return "堂主";
			if(job == 3) return "护法";
			if(job == 4) return "帮主";
			return job.toString();
		}
		private function onBtnCreate(e:Event):void
		{
			FrameFactionCreate.show();
		}
		public static var _frame:FrameFaction = null;
		public static function show():void
		{
			if(isShowing())
			{
				hide();
				return;
			}
			if(_frame == null)
			{
				_frame = new FrameFaction();
				PanelMainHelp.getInstance().addChild(_frame);
			}
			_frame.show();
			_frame.init();
			if(FrameFaction.isInFaction())
				Client.getInstance().sendPacketLogic(1803,[int(CharInfo.m_objFaction.m_nFactionVersion)]);
			//_frame.update();
			PanelMainHelp.getInstance().bringToTop(_frame);
		}
		public static function hide():void
		{
			if(isShowing())_frame.hide();
		}
		public static function isShowing():Boolean
		{
			return(_frame != null&& _frame.isShowing());
		}
		public static var rankVersion:int = 0;
		public static var listCharInfoRank:Array = new Array();
		public static function phFactionRank_1800(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phFactionRank_1800", msg);
			var nIndex:uint = 0;
			var index:int = 0;
			var version:int = msg[index++];
			var page_index:int = msg[index++];
			var item_per_page:int = msg[index++];
			var count:int = msg[index++];
			if(listCharInfoRank[page_index] == null)
				listCharInfoRank[page_index] = new Array;
			if(rankVersion != version)
			{
				listCharInfoRank[page_index].splice(0,listCharInfoRank[page_index].length);
				rankVersion = version;
			}
			
			for(var i:int = 0; i != count; i++)
			{
				var obj:Object = new Object;
				obj.index = msg[index++]+1;
				obj.m_nFactionId = msg[index++];
				obj.m_szFactionName = msg[index++];
				obj.m_nLevel = msg[index++];
				obj.m_nMasterCharId = msg[index++];
				obj.m_szMasterCharName = msg[index++];
				obj.m_nMembersSize = msg[index++];
				obj.m_nMembersSizeMax = msg[index++];
				
				listCharInfoRank[page_index][obj.index-1] = obj;
			}
			
			if(isShowing())
				_frame.update();
		}
		public static function isInFaction():Boolean
		{
			return (int(CharInfo.m_objFaction.m_nFactionId) != 0 ? true : false);
		}
		public static function isFactionMaster():Boolean
		{
			if(!isInFaction())
				return false;
			return (int(CharInfo.m_objFaction.m_nMasterCharId) == CharInfo.accountId ? true : false);
		}
		public static function phFaction_1803(e:PacketEvent):void
		{
			var msg:Array = e.data as Array;
			trace("phFaction_1803", msg);
			var nIndex:uint = 0;
			CharInfo.m_objFaction.m_nFactionId = msg[nIndex++];
			CharInfo.m_objFaction.m_szFactionName = msg[nIndex++];
			
			if(CharInfo.m_objFaction.m_nFactionId != 0)
			{
				CharInfo.m_objFaction.m_nFactionVersion = msg[nIndex++];
				CharInfo.m_objFaction.m_nLevel = msg[nIndex++];
				CharInfo.m_objFaction.m_nPrestige = msg[nIndex++];
				CharInfo.m_objFaction.m_szTenet = msg[nIndex++];
				CharInfo.m_objFaction.m_szNotice = msg[nIndex++];
				CharInfo.m_objFaction.m_nMasterCharId = msg[nIndex++];
				CharInfo.m_objFaction.m_szMasterCharName = msg[nIndex++];
				CharInfo.m_objFaction.m_nDevote = msg[nIndex++];
				CharInfo.m_objFaction.m_nJob = msg[nIndex++];
				if(CharInfo.m_objFaction.m_arMembers == null)
					CharInfo.m_objFaction.m_arMembers = [];
				//(CharInfo.m_objFaction.m_arMembers as Array).splice(0,(CharInfo.m_objFaction.m_arMembers as Array).length);
				
				var nCount:uint = msg[nIndex++];
				var array:Array = CharInfo.m_objFaction.m_arMembers;
				array.splice(0,array.length);
				var obj:Object = null;
				var i:int = 0;
				for(i = 0; i < nCount; i++)
				{
					obj = new Object();
					array[i] = obj;
					obj.m_nCharId = msg[nIndex++];
					obj.m_szCharName = msg[nIndex++];
					obj.m_nLevel = msg[nIndex++];
					obj.m_nRace = msg[nIndex++];
					obj.m_nGender = msg[nIndex++];
					obj.m_nJob = msg[nIndex++];
					obj.m_nDevote = msg[nIndex++];
					obj.m_nJoinTime = msg[nIndex++];
				}
				
				if(CharInfo.m_objFaction.m_arApplicants == null)
					CharInfo.m_objFaction.m_arApplicants = [];
				
				nCount = msg[nIndex++];
				array = CharInfo.m_objFaction.m_arApplicants;
				array.splice(0,array.length);
				for(i = 0; i < nCount; i++)
				{
					obj = new Object();
					array[i] = obj;
					obj.m_nCharId = msg[nIndex++];
					obj.m_szCharName = msg[nIndex++];
					obj.m_nLevel = msg[nIndex++];
					obj.m_nRace = msg[nIndex++];
					obj.m_nGender = msg[nIndex++];
					obj.m_nApplicantTime = msg[nIndex++];
				}
				nCount = msg[nIndex++];
				i = 0;
	
				if(CharInfo.m_objFaction.m_arTrends == null)
					CharInfo.m_objFaction.m_arTrends = [];
				CharInfo.m_objFaction.m_arTrends.splice(0,CharInfo.m_objFaction.m_arTrends.length);
				for(i = 0; i < nCount; i++)
				{
					CharInfo.m_objFaction.m_arTrends.push(msg[nIndex++]);
				}
			}
			if(isShowing())
				_frame.init();
		}
	}
}

import com.*;
import com.Engine.*;
import com.Packet.*;
import com.UI.*;

import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;

//import mx.containers.Panel;

import org.aswing.*;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.dnd.*;
import org.aswing.event.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
import org.aswing.tree.AbstractLayoutCache;


/**
 * MyPaneFactonCreate
 */
class FrameFactionCreate  extends JFrame
{
	
	//members define
	private var labelReqairLevel:JLabel;
	private var labelLevel:JLabel;
	private var labelReqairMoney:JLabel;
	private var labelMoney:JLabel;
	private var txtName:JTextField;
	private var btn_faction_create:JButton;
	
	/**
	 * MyPaneFactonCreate Constructor
	 */
	private var btn_close:JButton;
	public function FrameFactionCreate()
	{
		
		setClosable(false);
		setResizable(false);  
		setBorder(new EmptyBorder());
		btn_close = new JButton();
		//btn_close.setLocation(new IntPoint(453, 8));
		btn_close.setSize(new IntDimension(27, 27));
		btn_close.setPreferredSize(new IntDimension(27, 27));
		this.getTitleBar().setCloseButton(btn_close);
		this.getTitleBar().setMinimizeHeight(32);
		this.setClipMasked(false);
		
		//component creation
		setSize(new IntDimension(175, 134));
		setPreferredSize(new IntDimension(175, 134));
		var layout0:EmptyLayout = new EmptyLayout();
		getContentPane().setLayout(layout0);
		
		labelReqairLevel = new JLabel();
		labelReqairLevel.setLocation(new IntPoint(39, 5));
		labelReqairLevel.setSize(new IntDimension(60, 17));
		labelReqairLevel.setPreferredSize(new IntDimension(60, 17));
		labelReqairLevel.setText("需要等级:");
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(105, 5));
		labelLevel.setSize(new IntDimension(50, 17));
		labelLevel.setPreferredSize(new IntDimension(50, 17));
		labelLevel.setText("30");
		labelLevel.setHorizontalAlignment(AsWingConstants.LEFT);
		
		labelReqairMoney = new JLabel();
		labelReqairMoney.setLocation(new IntPoint(39, 22));
		labelReqairMoney.setSize(new IntDimension(60, 17));
		labelReqairMoney.setPreferredSize(new IntDimension(60, 17));
		labelReqairMoney.setText("需要铜币:");
		
		labelMoney = new JLabel();
		labelMoney.setLocation(new IntPoint(105, 22));
		labelMoney.setSize(new IntDimension(50, 17));
		labelMoney.setPreferredSize(new IntDimension(50, 17));
		labelMoney.setText("500000");
		labelMoney.setHorizontalAlignment(AsWingConstants.LEFT);
		
		txtName = new JTextField();
		txtName.setLocation(new IntPoint(39, 66));
		txtName.setSize(new IntDimension(98, 20));
		txtName.setPreferredSize(new IntDimension(98, 20));
		
		btn_faction_create = new JButton();
		btn_faction_create.setLocation(new IntPoint(61, 91));
		btn_faction_create.setSize(new IntDimension(52, 27));
		btn_faction_create.setPreferredSize(new IntDimension(52, 27));
		btn_faction_create.setText("label");
		
		//component layoution
		getContentPane().append(labelReqairLevel);
		getContentPane().append(labelLevel);
		getContentPane().append(labelReqairMoney);
		getContentPane().append(labelMoney);
		getContentPane().append(txtName);
		getContentPane().append(btn_faction_create);
		
		setImages();
	}
	public function setImages():void
	{
		var img_char_background:DisplayObject = Client.getUIElement("img_faction_create_bg") as DisplayObject
		setBackgroundDecorator(new AssetBackground(img_char_background));
		setSizeWH(img_char_background.width,img_char_background.height);
		setLocationXY((Engine.W - img_char_background.width) / 2,(Engine.H - img_char_background.height)/2);
		btn_close.wrapSimpleButton(Client.getUIElement("btn_close") as SimpleButton);
		
		btn_faction_create.wrapSimpleButton(Client.getUIElement("btn_faction_create") as SimpleButton);
		btn_faction_create.setText("");
		
		btn_faction_create.addActionListener(onBtnCreate);
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelReqairLevel.setForeground(ASColor.ORANGE);
		labelReqairLevel.setFont(font);
		labelReqairLevel.setTextFilters(new Array(filter));
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setFont(font);
		labelLevel.setTextFilters(new Array(filter));
		
		labelReqairMoney.setForeground(ASColor.ORANGE);
		labelReqairMoney.setFont(font);
		labelReqairMoney.setTextFilters(new Array(filter));
		labelMoney.setForeground(ASColor.WHITE);
		labelMoney.setFont(font);
		labelMoney.setTextFilters(new Array(filter));
		
		var txtFormat:TextFormat = new TextFormat("宋体", 12, 0xffffff, false, false, false);
		txtName.setDefaultTextFormat(txtFormat);
		txtName.setBackgroundDecorator(null);
		txtName.addActionListener(onBtnCreate);
		//txtName.addEventListener(AWEvent.FOCUS_GAINED,onChatInputFucusGained);
		//txtName.addEventListener(AWEvent.FOCUS_LOST,onChatInputFucusLost);
		
		txtName.filters = new Array(new GlowFilter(0x000000, 1, 2, 2, 2));
		txtName.setClipMasked(false);
		
	}
	private function onBtnCreate(e:Event):void
	{
		if(txtName.getText().length <= 0)
		{
			PanelMain.showInfo("请输入帮派名称");
			return;
		}
		this.closeReleased();
		Client.getInstance().sendPacketLogic(1801,[txtName.getText()]);
	}
	public static var _frame:FrameFactionCreate = null;
	public static function show():void
	{
		if(isShowing())
		{
			hide();
			return;
		}
		if(_frame == null)
		{
			_frame = new FrameFactionCreate();
			PanelMainHelp.getInstance().addChild(_frame);
		}
		_frame.show();
		PanelMainHelp.getInstance().bringToTop(_frame);
	}
	public static function hide():void
	{
		if(isShowing())_frame.hide();
	}
	public static function isShowing():Boolean
	{
		return(_frame != null&& _frame.isShowing());
	}
	
	
}

/**
 * MyPaneFactonBRank
 */
class PaneFactionBRank extends JPanel{
	
	//members define
	private var panelItems:JPanel;
	private var panelBCenter:JPanel;
	private var btnPrev:JButton;
	private var labelPage:JLabel;
	private var btnNext:JButton;
	
	
	/**
	 * MyPaneFactonBRank Constructor
	 */
	public function PaneFactionBRank(){
		//component creation
		setSize(new IntDimension(425, 308));
		setPreferredSize(new IntDimension(425, 308));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panelItems = new JPanel();
		panelItems.setLocation(new IntPoint(0, 24));
		panelItems.setSize(new IntDimension(425, 253));
		panelItems.setPreferredSize(new IntDimension(425, 253));
		var layout1:GridLayout = new GridLayout();
		layout1.setRows(11);
		layout1.setColumns(1);
		layout1.setHgap(0);
		layout1.setVgap(0);
		panelItems.setLayout(layout1);
		
		panelBCenter = new JPanel();
		panelBCenter.setLocation(new IntPoint(160, 281));
		panelBCenter.setSize(new IntDimension(104, 24));
		panelBCenter.setPreferredSize(new IntDimension(104, 24));
		var layout2:FlowLayout = new FlowLayout();
		layout2.setAlignment(AsWingConstants.CENTER);
		layout2.setHgap(5);
		layout2.setVgap(0);
		layout2.setMargin(false);
		panelBCenter.setLayout(layout2);
		
		btnPrev = new JButton();
		btnPrev.setLocation(new IntPoint(4, 0));
		btnPrev.setSize(new IntDimension(29, 24));
		btnPrev.setPreferredSize(new IntDimension(29, 24));
		btnPrev.setText("label");
		
		labelPage = new JLabel();
		labelPage.setLocation(new IntPoint(51, 4));
		labelPage.setSize(new IntDimension(36, 16));
		labelPage.setPreferredSize(new IntDimension(36, 16));
		labelPage.setText("label");
		
		btnNext = new JButton();
		btnNext.setLocation(new IntPoint(70, 0));
		btnNext.setSize(new IntDimension(29, 24));
		btnNext.setPreferredSize(new IntDimension(29, 24));
		btnNext.setText("label");
		
		//component layoution
		append(panelItems);
		append(panelBCenter);
		
		panelBCenter.append(btnPrev);
		panelBCenter.append(labelPage);
		panelBCenter.append(btnNext);
		
		//-------------------
		setImages();
		updatePage();
	}
	private var _mallItems:Array = new Array();
	public function setImages():void
	{
		btnPrev.setText("");
		btnNext.setText("");
		
		btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
		btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
		
		btnPrev.addActionListener(onBtnPrev);
		btnNext.addActionListener(onBtnNext);
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelPage.setForeground(ASColor.WHITE);
		labelPage.setFont(font);
		labelPage.setTextFilters(new Array(filter));
		
		for(var i:int = 0; i < _itemsPerPage; i++)
		{
			var item:PaneFactionBRankItem = new PaneFactionBRankItem;
			panelItems.append(item);
			_mallItems.push(item);
		}
	}
	public function update(updateFromServer:Boolean = true):void
	{
		if(FrameFaction.listCharInfoRank[_currentPageIndex] == null)
			FrameFaction.listCharInfoRank[_currentPageIndex] = [];
		
		var objects:Array = FrameFaction.listCharInfoRank[_currentPageIndex];
		
		
		if(updateFromServer)
		{
			var version:int = FrameFaction.rankVersion;
			if(objects[_currentPageIndex*_itemsPerPage] == null)
				version = 0;
			Client.getInstance().sendPacketLogic(1800,[version,_currentPageIndex,_itemsPerPage]);
		}
		updatePage();
	}
	private var _currentPageIndex:int = 0;
	private var _currentPageIndexAll:int = 0;
	private var _itemsPerPage:int = 11;
	public function updatePage():void
	{
		if(FrameFaction.listCharInfoRank[_currentPageIndex] == null)
			FrameFaction.listCharInfoRank[_currentPageIndex] = [];
		for each(var obj:Object in _mallItems)
		{
			obj.item = null;
		}
		var nIndex:int = 0;
		var nCount:int = 0;
		for each(var item:Object in FrameFaction.listCharInfoRank[_currentPageIndex])
		{
			nCount++;
			if(nCount <= _currentPageIndex*_itemsPerPage)
				continue;
			_mallItems[nIndex++].item = item;
			if(nIndex >= _itemsPerPage)
				break;
		}
		
		var nCount1:int = FrameFaction.listCharInfoRank[_currentPageIndex].length;
		_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
		btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
	}
	
	private function onBtnPrev(event:Event):void
	{
		_currentPageIndex--;
		if(_currentPageIndex < 0)
			_currentPageIndex = 0;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	private function onBtnNext(event:Event):void
	{
		_currentPageIndex++;
		if(_currentPageIndex > _currentPageIndexAll-1)
			_currentPageIndex = _currentPageIndexAll-1;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	//_________getters_________
	
	
	
}
/**
 * MyPaneFactonBRankItem
 */
class PaneFactionBRankItem extends JPanel{
	
	//members define
	
	//members define
	private var labelIndex:JLabel;
	private var labelName:JLabel;
	private var labelMaster:JLabel;
	private var labelLevel:JLabel;
	private var labelMemberCount:JLabel;
	private var btn_faction_applicant:JButton;
	
	/**
	 * MyPaneFactonBRankItem Constructor
	 */
	public function PaneFactionBRankItem(){
		//component creation
		setSize(new IntDimension(425, 23));
		setPreferredSize(new IntDimension(425, 23));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelIndex = new JLabel();
		labelIndex.setLocation(new IntPoint(0, 3));
		labelIndex.setSize(new IntDimension(50, 16));
		labelIndex.setPreferredSize(new IntDimension(50, 16));
		labelIndex.setText("label");
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(51, 3));
		labelName.setSize(new IntDimension(70, 16));
		labelName.setPreferredSize(new IntDimension(70, 16));
		labelName.setText("label");
		
		labelMaster = new JLabel();
		labelMaster.setLocation(new IntPoint(122, 3));
		labelMaster.setSize(new IntDimension(89, 16));
		labelMaster.setPreferredSize(new IntDimension(89, 16));
		labelMaster.setText("label");
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(212, 3));
		labelLevel.setSize(new IntDimension(73, 16));
		labelLevel.setPreferredSize(new IntDimension(73, 16));
		labelLevel.setText("label");
		
		labelMemberCount = new JLabel();
		labelMemberCount.setLocation(new IntPoint(286, 3));
		labelMemberCount.setSize(new IntDimension(69, 16));
		labelMemberCount.setPreferredSize(new IntDimension(69, 16));
		labelMemberCount.setText("label");
		
		btn_faction_applicant = new JButton();
		btn_faction_applicant.setLocation(new IntPoint(358, 0));
		btn_faction_applicant.setSize(new IntDimension(66, 22));
		btn_faction_applicant.setPreferredSize(new IntDimension(66, 22));
		btn_faction_applicant.setText("label");
		
		//component layoution
		append(labelIndex);
		append(labelName);
		append(labelMaster);
		append(labelLevel);
		append(labelMemberCount);
		append(btn_faction_applicant);
		
		
		//------------------------
		
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelIndex.setForeground(ASColor.ORANGE);
		labelIndex.setFont(font);
		labelIndex.setTextFilters(new Array(filter));
		
		labelName.setForeground(ASColor.WHITE);
		labelName.setFont(font);
		labelName.setTextFilters(new Array(filter));
		labelMaster.setForeground(ASColor.WHITE);
		labelMaster.setFont(font);
		labelMaster.setTextFilters(new Array(filter));
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setFont(font);
		labelLevel.setTextFilters(new Array(filter));
		labelMemberCount.setForeground(ASColor.WHITE);
		labelMemberCount.setFont(font);
		labelMemberCount.setTextFilters(new Array(filter));
		
		btn_faction_applicant.setText("");
		btn_faction_applicant.wrapSimpleButton(Client.getUIElement("btn_faction_applicant") as SimpleButton);
		
		btn_faction_applicant.addActionListener(onBtnFactionApplicant);
	}
	private function onBtnFactionApplicant(e:Event):void
	{
		if(_item == null)
			return;
		Client.getInstance().sendPacketLogic(1805,[int(_item.m_nFactionId)]);
	}
	//_________getters_________
	private var _item:Object = null;
	public function set item(val:Object):void
	{
		_item = val;
		labelIndex.setText("");
		labelName.setText("");
		labelMaster.setText("");
		labelLevel.setText("");
		labelMemberCount.setText("");
		btn_faction_applicant.setVisible(false);
		if(_item == null)
		{
			return;
		}
		labelIndex.setText(_item.index);
		labelName.setText(_item.m_szFactionName);
		labelMaster.setText(_item.m_szMasterCharName);
		labelLevel.setText(_item.m_nLevel);
		labelMemberCount.setText(_item.m_nMembersSize + '/'+_item.m_nMembersSizeMax);
		btn_faction_applicant.setVisible(true);
		btn_faction_applicant.setEnabled(!FrameFaction.isInFaction());
		pack();
		this.paintImmediately();
	}
	public function get item():Object
	{
		return _item;
	}
	
}
/**
 * MyPaneFactonBMine
 */
class PaneFactionBMine extends JPanel{
	
	//members define
	private var panel30:JPanel;
	private var btn_faction_tab_pandect:JToggleButton;
	private var btn_faction_tab_members:JToggleButton;
	private var btn_faction_tab_trends:JToggleButton;
	private var btn_faction_tab_applicant:JToggleButton;
	private var panelBottom:JPanel;
	
	/**
	 * MyPaneFactonBMine Constructor
	 */
	private var panelBottomPandect:PaneFactionBMinePandect;
	private var panelBottomMembers:PaneFactionBMineMembers;
	private var panelBottomTrends:PaneFactionBMineTrends;
	private var panelBottomApplicant:PaneFactionBMineApplicant;
	public function PaneFactionBMine(){
		//component creation
		setSize(new IntDimension(425, 308));
		setPreferredSize(new IntDimension(425, 308));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panel30 = new JPanel();
		panel30.setLocation(new IntPoint(0, 0));
		panel30.setSize(new IntDimension(425, 24));
		panel30.setPreferredSize(new IntDimension(425, 24));
		var layout1:EmptyLayout = new EmptyLayout();
		panel30.setLayout(layout1);
		
		btn_faction_tab_pandect = new JToggleButton();
		btn_faction_tab_pandect.setLocation(new IntPoint(12, 0));
		btn_faction_tab_pandect.setSize(new IntDimension(73, 24));
		btn_faction_tab_pandect.setPreferredSize(new IntDimension(73, 24));
		btn_faction_tab_pandect.setText("label");
		
		btn_faction_tab_members = new JToggleButton();
		btn_faction_tab_members.setLocation(new IntPoint(86, 0));
		btn_faction_tab_members.setSize(new IntDimension(73, 24));
		btn_faction_tab_members.setPreferredSize(new IntDimension(73, 24));
		btn_faction_tab_members.setText("label");
		
		btn_faction_tab_trends = new JToggleButton();
		btn_faction_tab_trends.setLocation(new IntPoint(160, 0));
		btn_faction_tab_trends.setSize(new IntDimension(73, 24));
		btn_faction_tab_trends.setPreferredSize(new IntDimension(73, 24));
		btn_faction_tab_trends.setText("label");
		
		btn_faction_tab_applicant = new JToggleButton();
		btn_faction_tab_applicant.setLocation(new IntPoint(233, 0));
		btn_faction_tab_applicant.setSize(new IntDimension(73, 24));
		btn_faction_tab_applicant.setPreferredSize(new IntDimension(73, 24));
		btn_faction_tab_applicant.setText("label");
		
		/*panelBottom = new JPanel();
		panelBottom.setLocation(new IntPoint(0, 24));
		panelBottom.setSize(new IntDimension(425, 284));
		panelBottom.setPreferredSize(new IntDimension(425, 284));*/
		
		//component layoution
		append(panel30);
		//append(panelBottom);
		
		panel30.append(btn_faction_tab_pandect);
		panel30.append(btn_faction_tab_members);
		panel30.append(btn_faction_tab_trends);
		panel30.append(btn_faction_tab_applicant);
		
		//-------------------
		
		panelBottomPandect = new PaneFactionBMinePandect();
		panelBottomPandect.setLocation(new IntPoint(0, 24));
		panelBottomPandect.setSize(new IntDimension(425, 284));
		panelBottomPandect.setPreferredSize(new IntDimension(425, 284));
		
		panelBottomMembers = new PaneFactionBMineMembers();
		panelBottomMembers.setLocation(new IntPoint(0, 24));
		panelBottomMembers.setSize(new IntDimension(425, 284));
		panelBottomMembers.setPreferredSize(new IntDimension(425, 284));
		
		panelBottomTrends = new PaneFactionBMineTrends();
		panelBottomTrends.setLocation(new IntPoint(0, 24));
		panelBottomTrends.setSize(new IntDimension(425, 284));
		panelBottomTrends.setPreferredSize(new IntDimension(425, 284));
		
		panelBottomApplicant = new PaneFactionBMineApplicant();
		panelBottomApplicant.setLocation(new IntPoint(0, 24));
		panelBottomApplicant.setSize(new IntDimension(425, 284));
		panelBottomApplicant.setPreferredSize(new IntDimension(425, 284));
		
		
		
		panelBottom = panelBottomPandect;
		
		append(panelBottom);
		
		setImages();
		this.setClipMasked(false);
		panelBottomMembers.setClipMasked(false);
	}
	public function init():void
	{
		btn_faction_tab_pandect.setSelected(true);
		btn_faction_tab_members.setSelected(false);
		btn_faction_tab_trends.setSelected(false);
		btn_faction_tab_applicant.setSelected(false);
		btn_faction_tab_applicant.setEnabled(FrameFaction.isFactionMaster());
		onBtnTabPandect(null);
	}
	public function update():void
	{
		if(panelBottom == panelBottomPandect)
			panelBottomPandect.update();
		if(panelBottom == panelBottomMembers)
			panelBottomMembers.update();
		if(panelBottom == panelBottomTrends)
			panelBottomTrends.update();
		if(panelBottom == panelBottomApplicant)
			panelBottomApplicant.update();
	}
	public function setImages():void
	{
		btn_faction_tab_pandect.wrapSimpleButton(Client.getUIElement("btn_faction_tab_pandect") as SimpleButton);
		btn_faction_tab_pandect.setText("");
		btn_faction_tab_members.wrapSimpleButton(Client.getUIElement("btn_faction_tab_members") as SimpleButton);
		btn_faction_tab_members.setText("");
		btn_faction_tab_trends.wrapSimpleButton(Client.getUIElement("btn_faction_tab_trends") as SimpleButton);
		btn_faction_tab_trends.setText("");
		btn_faction_tab_applicant.wrapSimpleButton(Client.getUIElement("btn_faction_tab_applicant") as SimpleButton);
		btn_faction_tab_applicant.setText("");
		
		btn_faction_tab_pandect.setSelected(true);
		var group:ButtonGroup = new ButtonGroup();
		group.appendAll(btn_faction_tab_pandect,btn_faction_tab_members,btn_faction_tab_trends,btn_faction_tab_applicant);
		
		btn_faction_tab_pandect.addActionListener(onBtnTabPandect);
		btn_faction_tab_members.addActionListener(onBtnTabMembers);
		btn_faction_tab_trends.addActionListener(onBtnTabTrends);
		btn_faction_tab_applicant.addActionListener(onBtnTabApplicant);
		
	}
	//_________getters_________
	private function onBtnTabPandect(e:Event):void
	{
		if(FrameFaction._frame.getBackgroundDecorator() != FrameFaction._frame.img_faction_pandect_bg)
			FrameFaction._frame.setBackgroundDecorator(FrameFaction._frame.img_faction_pandect_bg);
		
		if(panelBottom != panelBottomPandect)
		{
			remove(panelBottom);
			panelBottom = panelBottomPandect;
			append(panelBottom);
		}
		update();
		paintImmediately();
	}
	private function onBtnTabMembers(e:Event):void
	{
		if(FrameFaction._frame.getBackgroundDecorator() != FrameFaction._frame.img_faction_members_bg)
			FrameFaction._frame.setBackgroundDecorator(FrameFaction._frame.img_faction_members_bg);
		
		if(panelBottom != panelBottomMembers)
		{
			remove(panelBottom);
			panelBottom = panelBottomMembers;
			append(panelBottom);
		}
		update();
		paintImmediately();
	}
	private function onBtnTabTrends(e:Event):void
	{
		if(FrameFaction._frame.getBackgroundDecorator() != FrameFaction._frame.img_faction_trends_bg)
			FrameFaction._frame.setBackgroundDecorator(FrameFaction._frame.img_faction_trends_bg);
		
		if(panelBottom != panelBottomTrends)
		{
			remove(panelBottom);
			panelBottom = panelBottomTrends;
			append(panelBottom);
		}
		update();
		paintImmediately();
	}
	private function onBtnTabApplicant(e:Event):void
	{
		if(FrameFaction._frame.getBackgroundDecorator() != FrameFaction._frame.img_faction_applicant_bg)
			FrameFaction._frame.setBackgroundDecorator(FrameFaction._frame.img_faction_applicant_bg);
		
		if(panelBottom != panelBottomApplicant)
		{
			remove(panelBottom);
			panelBottom = panelBottomApplicant;
			append(panelBottom);
		}
		update();
		paintImmediately();
	}
	
}

/**
 * MyPaneFactionBMinePandect
 */
class PaneFactionBMinePandect extends JPanel{
	
	//members define
	private var labelName:JLabel;
	private var labelMaster:JLabel;
	private var labelLevel:JLabel;
	private var btn_faction_levelup:JButton;
	private var labelPrestige:JLabel;
	private var labelJob:JLabel;
	private var btn_faction_donate:JButton;
	private var btn_faction_exit:JButton;
	private var btn_faction_save:JButton;
	private var labelTenet:JLabel;
	private var txtTenet:JTextArea;
	private var labelNotice:JLabel;
	private var txtNotice:JTextArea;
	
	/**
	 * MyPaneFactionBMinePandect Constructor
	 */
	public function PaneFactionBMinePandect(){
		//component creation
		setSize(new IntDimension(425, 284));
		setPreferredSize(new IntDimension(425, 284));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(39, 4));
		labelName.setSize(new IntDimension(80, 17));
		labelName.setPreferredSize(new IntDimension(80, 17));
		labelName.setText("label");
		labelName.setHorizontalAlignment(AsWingConstants.LEFT);
		
		labelMaster = new JLabel();
		labelMaster.setLocation(new IntPoint(39, 26));
		labelMaster.setSize(new IntDimension(80, 17));
		labelMaster.setPreferredSize(new IntDimension(80, 17));
		labelMaster.setText("label");
		labelMaster.setHorizontalAlignment(AsWingConstants.LEFT);
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(39, 48));
		labelLevel.setSize(new IntDimension(34, 17));
		labelLevel.setPreferredSize(new IntDimension(34, 17));
		labelLevel.setText("150");
		labelLevel.setHorizontalAlignment(AsWingConstants.LEFT);
		
		btn_faction_levelup = new JButton();
		btn_faction_levelup.setLocation(new IntPoint(74, 45));
		btn_faction_levelup.setSize(new IntDimension(46, 23));
		btn_faction_levelup.setPreferredSize(new IntDimension(46, 23));
		btn_faction_levelup.setText("label");
		
		labelPrestige = new JLabel();
		labelPrestige.setLocation(new IntPoint(39, 70));
		labelPrestige.setSize(new IntDimension(80, 17));
		labelPrestige.setPreferredSize(new IntDimension(80, 17));
		labelPrestige.setText("label");
		labelPrestige.setHorizontalAlignment(AsWingConstants.LEFT);
		
		labelJob = new JLabel();
		labelJob.setLocation(new IntPoint(39, 92));
		labelJob.setSize(new IntDimension(80, 17));
		labelJob.setPreferredSize(new IntDimension(80, 17));
		labelJob.setText("label");
		labelJob.setHorizontalAlignment(AsWingConstants.LEFT);
		
		btn_faction_donate = new JButton();
		btn_faction_donate.setLocation(new IntPoint(20, 130));
		btn_faction_donate.setSize(new IntDimension(82, 25));
		btn_faction_donate.setPreferredSize(new IntDimension(82, 25));
		btn_faction_donate.setText("label");
		
		btn_faction_exit = new JButton();
		btn_faction_exit.setLocation(new IntPoint(20, 160));
		btn_faction_exit.setSize(new IntDimension(82, 25));
		btn_faction_exit.setPreferredSize(new IntDimension(82, 25));
		btn_faction_exit.setText("label");
		
		btn_faction_save = new JButton();
		btn_faction_save.setLocation(new IntPoint(20, 190));
		btn_faction_save.setSize(new IntDimension(82, 25));
		btn_faction_save.setPreferredSize(new IntDimension(82, 25));
		btn_faction_save.setText("label");
		
		labelTenet = new JLabel();
		labelTenet.setLocation(new IntPoint(122, 1));
		labelTenet.setSize(new IntDimension(303, 17));
		labelTenet.setPreferredSize(new IntDimension(303, 17));
		labelTenet.setText("帮派宗旨");
		
		txtTenet = new JTextArea();
		txtTenet.setLocation(new IntPoint(122, 18));
		txtTenet.setSize(new IntDimension(303, 92));
		txtTenet.setPreferredSize(new IntDimension(303, 92));
		
		labelNotice = new JLabel();
		labelNotice.setLocation(new IntPoint(122, 111));
		labelNotice.setSize(new IntDimension(303, 17));
		labelNotice.setPreferredSize(new IntDimension(303, 17));
		labelNotice.setText("帮派公告");
		
		txtNotice = new JTextArea();
		txtNotice.setLocation(new IntPoint(122, 128));
		txtNotice.setSize(new IntDimension(303, 156));
		txtNotice.setPreferredSize(new IntDimension(303, 156));
		
		//component layoution
		append(labelName);
		append(labelMaster);
		append(labelLevel);
		append(btn_faction_levelup);
		append(labelPrestige);
		append(labelJob);
		append(btn_faction_donate);
		append(btn_faction_exit);
		append(btn_faction_save);
		append(labelTenet);
		append(txtTenet);
		append(labelNotice);
		append(txtNotice);
		
		//-------------------
		setImages();
	}
	private var _mallItems:Array = new Array();
	public function setImages():void
	{
		btn_faction_levelup.wrapSimpleButton(Client.getUIElement("btn_faction_levelup") as SimpleButton);
		btn_faction_levelup.setText("");
		btn_faction_donate.wrapSimpleButton(Client.getUIElement("btn_faction_donate") as SimpleButton);
		btn_faction_donate.setText("");
		btn_faction_exit.wrapSimpleButton(Client.getUIElement("btn_faction_exit") as SimpleButton);
		btn_faction_exit.setText("");
		btn_faction_save.wrapSimpleButton(Client.getUIElement("btn_faction_save") as SimpleButton);
		btn_faction_save.setText("");

		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setForeground(ASColor.WHITE);
		labelName.setFont(font);
		labelName.setTextFilters(new Array(filter));
		
		labelMaster.setForeground(ASColor.WHITE);
		labelMaster.setFont(font);
		labelMaster.setTextFilters(new Array(filter));
		
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setFont(font);
		labelLevel.setTextFilters(new Array(filter));
		
		labelPrestige.setForeground(ASColor.WHITE);
		labelPrestige.setFont(font);
		labelPrestige.setTextFilters(new Array(filter));
		
		labelJob.setForeground(ASColor.WHITE);
		labelJob.setFont(font);
		labelJob.setTextFilters(new Array(filter));
		
		font = new ASFont("宋体", 14, false, false, false, false);
		labelTenet.setForeground(ASColor.ORANGE);
		labelTenet.setFont(font);
		labelTenet.setTextFilters(new Array(filter));
		
		labelNotice.setForeground(ASColor.ORANGE);
		labelNotice.setFont(font);
		labelNotice.setTextFilters(new Array(filter));
		
		txtTenet.addEventListener(AWEvent.FOCUS_GAINED,onTenetFucusGained);
		txtTenet.addEventListener(AWEvent.FOCUS_LOST,onTenetFucusLost);
		
		txtNotice.addEventListener(AWEvent.FOCUS_GAINED,onNoticeFucusGained);
		txtNotice.addEventListener(AWEvent.FOCUS_LOST,onNoticeFucusLost);
		
		
		var txtFormat:TextFormat = new TextFormat("宋体", 12, 0xffffff, false, false, false);
		txtTenet.setDefaultTextFormat(txtFormat);
		//txtTenet.setBackgroundDecorator(null);
		txtTenet.filters = new Array(new GlowFilter(0x000000, 1, 2, 2, 2));
		txtTenet.setClipMasked(false);
		txtTenet.setOpaque(false);
		txtTenet.setBackground(new ASColor(0x00212b,0.5));
		
		txtNotice.setDefaultTextFormat(txtFormat);
		//txtNotice.setBackgroundDecorator(null);
		txtNotice.filters = new Array(new GlowFilter(0x000000, 1, 2, 2, 2));
		txtNotice.setClipMasked(false);
		txtNotice.setOpaque(false);
		txtNotice.setBackground(new ASColor(0x00212b,0.5));
		btn_faction_levelup.addActionListener(onBtnFactionLevelup);
		btn_faction_donate.addActionListener(onBtnFactionDonate);
		btn_faction_exit.addActionListener(onBtnFactionExit);
		btn_faction_save.addActionListener(onBtnFactionSave);
	}
	public function update():void
	{
		/*CharInfo.m_objFaction.m_nFactionId = msg[nIndex++];
		CharInfo.m_objFaction.m_szFactionName = msg[nIndex++];
		CharInfo.m_objFaction.m_nLevel = msg[nIndex++];
		CharInfo.m_objFaction.m_nPrestige = msg[nIndex++];
		CharInfo.m_objFaction.m_szTenet = msg[nIndex++];
		CharInfo.m_objFaction.m_szNotice = msg[nIndex++];
		CharInfo.m_objFaction.m_nMasterCharId = msg[nIndex++];
		CharInfo.m_objFaction.m_szMasterCharName = msg[nIndex++];
		CharInfo.m_objFaction.m_nDevote = msg[nIndex++];
		CharInfo.m_objFaction.m_nJob = msg[nIndex++];*/
		
		labelName.setText(CharInfo.m_objFaction.m_szFactionName);
		labelMaster.setText(CharInfo.m_objFaction.m_szMasterCharName);
		labelLevel.setText(CharInfo.m_objFaction.m_nLevel);
		labelPrestige.setText(CharInfo.m_objFaction.m_nPrestige);
		labelJob.setText(FrameFaction.getJobName(CharInfo.m_objFaction.m_nJob));
		txtTenet.setText(CharInfo.m_objFaction.m_szTenet != null ? CharInfo.m_objFaction.m_szTenet : "");
		txtNotice.setText(CharInfo.m_objFaction.m_szNotice != null ? CharInfo.m_objFaction.m_szNotice : "");
		btn_faction_levelup.setEnabled(FrameFaction.isFactionMaster());
		btn_faction_save.setEnabled(txtTenet.getText() != CharInfo.m_objFaction.m_szTenet || txtNotice.getText() != CharInfo.m_objFaction.m_szNotice);
		
		txtTenet.setEditable(FrameFaction.isFactionMaster());
		txtNotice.setEditable(FrameFaction.isFactionMaster());
	}
	
	private function onBtnFactionLevelup(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1807,[int(CharInfo.m_objFaction.m_nFactionId)]);
	}
	private function onBtnFactionDonate(e:Event):void
	{
		//Client.getInstance().sendPacketLogic(1808,[int(CharInfo.m_objFaction.m_nFactionId)]);
		FrameInfo.showInputDialog("","请输入要捐献的铜币: ",handleOptionDonate,"",null,true,null);
	}
	
	private function handleOptionDonate(inputText:String):void
	{
		if(inputText !=	null)
		{
			if(int(inputText) <= 0)
			{
				FrameInfo.showMessageDialog("","请输入要捐献的铜币!",null,null,true,null);
				return;
			}
			
			//Client.getInstance().sendPacketLogic(101,[selectedIndex,inputText]);
			Client.getInstance().sendPacketLogic(1808,[int(CharInfo.m_objFaction.m_nFactionId),int(inputText)]);
		}
		
	}
	private function onBtnFactionExit(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1809,[int(CharInfo.m_objFaction.m_nFactionId)]);
	}
	private function onBtnFactionSave(e:Event):void
	{
		Client.getInstance().sendPacketLogic(1810,[int(CharInfo.m_objFaction.m_nFactionId),txtTenet.getText(),txtNotice.getText()]);
	}
	private function onTenetFucusGained(e:Event):void
	{
		if(!FrameFaction.isFactionMaster())return;
		txtTenet.setOpaque(true);
		btn_faction_save.setEnabled(txtTenet.getText() != CharInfo.m_objFaction.m_szTenet || txtNotice.getText() != CharInfo.m_objFaction.m_szNotice);
	}
	
	private function onTenetFucusLost(e:Event):void
	{
		txtTenet.setOpaque(false);
		btn_faction_save.setEnabled(txtTenet.getText() != CharInfo.m_objFaction.m_szTenet || txtNotice.getText() != CharInfo.m_objFaction.m_szNotice);
	}
	
	private function onNoticeFucusGained(e:Event):void
	{
		if(!FrameFaction.isFactionMaster())return;
		txtNotice.setOpaque(true);
		btn_faction_save.setEnabled(txtTenet.getText() != CharInfo.m_objFaction.m_szTenet || txtNotice.getText() != CharInfo.m_objFaction.m_szNotice);
	}
	
	private function onNoticeFucusLost(e:Event):void
	{
		txtNotice.setOpaque(false);
		btn_faction_save.setEnabled(txtTenet.getText() != CharInfo.m_objFaction.m_szTenet || txtNotice.getText() != CharInfo.m_objFaction.m_szNotice);
	}
}

/**
 * MyPaneFactionBMineMembers
 */
class PaneFactionBMineMembers extends JPanel{
	
	//members define
	private var panelItems:JPanel;
	private var panelBCenter:JPanel;
	private var btnPrev:JButton;
	private var labelPage:JLabel;
	private var btnNext:JButton;
	
	/**
	 * MyPaneFactionBMineMembers Constructor
	 */
	public function PaneFactionBMineMembers(){
		//component creation
		setSize(new IntDimension(425, 284));
		setPreferredSize(new IntDimension(425, 284));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panelItems = new JPanel();
		panelItems.setLocation(new IntPoint(0, 24));
		panelItems.setSize(new IntDimension(425, 230));
		panelItems.setPreferredSize(new IntDimension(425, 230));
		var layout1:GridLayout = new GridLayout();
		layout1.setRows(10);
		layout1.setColumns(1);
		layout1.setHgap(0);
		layout1.setVgap(0);
		panelItems.setLayout(layout1);
		
		panelBCenter = new JPanel();
		panelBCenter.setLocation(new IntPoint(160, 257));
		panelBCenter.setSize(new IntDimension(104, 24));
		panelBCenter.setPreferredSize(new IntDimension(104, 24));
		var layout2:FlowLayout = new FlowLayout();
		layout2.setAlignment(AsWingConstants.CENTER);
		layout2.setHgap(5);
		layout2.setVgap(0);
		layout2.setMargin(false);
		panelBCenter.setLayout(layout2);
		
		btnPrev = new JButton();
		btnPrev.setLocation(new IntPoint(4, 0));
		btnPrev.setSize(new IntDimension(29, 24));
		btnPrev.setPreferredSize(new IntDimension(29, 24));
		btnPrev.setText("label");
		
		labelPage = new JLabel();
		labelPage.setLocation(new IntPoint(34, 4));
		labelPage.setSize(new IntDimension(36, 16));
		labelPage.setPreferredSize(new IntDimension(36, 16));
		labelPage.setText("label");
		
		btnNext = new JButton();
		btnNext.setLocation(new IntPoint(70, 0));
		btnNext.setSize(new IntDimension(29, 24));
		btnNext.setPreferredSize(new IntDimension(29, 24));
		btnNext.setText("label");
		
		//component layoution
		append(panelItems);
		append(panelBCenter);
		
		panelBCenter.append(btnPrev);
		panelBCenter.append(labelPage);
		panelBCenter.append(btnNext);
		
		//-------------------
		setImages();
		updatePage();
		this.setClipMasked(false);
		panelItems.setClipMasked(false);
	}
	private var _mallItems:Array = new Array();
	public function setImages():void
	{
		btnPrev.setText("");
		btnNext.setText("");
		
		btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
		btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
		
		btnPrev.addActionListener(onBtnPrev);
		btnNext.addActionListener(onBtnNext);
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelPage.setForeground(ASColor.WHITE);
		labelPage.setFont(font);
		labelPage.setTextFilters(new Array(filter));
		
		for(var i:int = 0; i < _itemsPerPage; i++)
		{
			var item:PaneFactionBMineMembersItem = new PaneFactionBMineMembersItem;
			panelItems.append(item);
			_mallItems.push(item);
		}
	}
	public function update():void
	{
		updatePage();
	}
	private var _currentPageIndex:int = 0;
	private var _currentPageIndexAll:int = 0;
	private var _itemsPerPage:int = 10;
	public function updatePage():void
	{
		if(CharInfo.m_objFaction.m_arMembers == null)
			CharInfo.m_objFaction.m_arMembers = [];
		for each(var obj:Object in _mallItems)
		{
			obj.item = null;
		}
		var nIndex:int = 0;
		var nCount:int = 0;
		for each(var item:Object in CharInfo.m_objFaction.m_arMembers)
		{
			nCount++;
			if(nCount <= _currentPageIndex*_itemsPerPage)
				continue;
			_mallItems[nIndex++].item = item;
			if(nIndex >= _itemsPerPage)
				break;
		}
		
		var nCount1:int = CharInfo.m_objFaction.m_arMembers.length;
		_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
		btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
	}
	
	private function onBtnPrev(event:Event):void
	{
		_currentPageIndex--;
		if(_currentPageIndex < 0)
			_currentPageIndex = 0;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	private function onBtnNext(event:Event):void
	{
		_currentPageIndex++;
		if(_currentPageIndex > _currentPageIndexAll-1)
			_currentPageIndex = _currentPageIndexAll-1;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	
}

/**
 * MyPaneFactionBMineMembersItem
 */
class PaneFactionBMineMembersItem extends JPanel{
	
	//members define
	//members define
	private var labelName:JLabel;
	private var labelLevel:JLabel;
	private var labelRace:JLabel;
	private var labelDevote:JLabel;
	private var labelJob:JLabel;
	private var labelJoinTime:JLabel;
	/**
	 * MyPaneFactionBMineMembersItem Constructor
	 */
	public function PaneFactionBMineMembersItem(){
		//component creation
		setSize(new IntDimension(425, 23));
		setPreferredSize(new IntDimension(425, 23));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(0, 3));
		labelName.setSize(new IntDimension(90, 17));
		labelName.setPreferredSize(new IntDimension(90, 17));
		labelName.setText("label");
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(91, 3));
		labelLevel.setSize(new IntDimension(43, 17));
		labelLevel.setPreferredSize(new IntDimension(43, 17));
		labelLevel.setText("label");
		
		labelRace = new JLabel();
		labelRace.setLocation(new IntPoint(135, 3));
		labelRace.setSize(new IntDimension(43, 17));
		labelRace.setPreferredSize(new IntDimension(43, 17));
		labelRace.setText("label");
		
		labelDevote = new JLabel();
		labelDevote.setLocation(new IntPoint(179, 3));
		labelDevote.setSize(new IntDimension(64, 17));
		labelDevote.setPreferredSize(new IntDimension(64, 17));
		labelDevote.setText("label");
		
		labelJob = new JLabel();
		labelJob.setLocation(new IntPoint(244, 3));
		labelJob.setSize(new IntDimension(75, 17));
		labelJob.setPreferredSize(new IntDimension(75, 17));
		labelJob.setText("label");
		
		labelJoinTime = new JLabel();
		labelJoinTime.setLocation(new IntPoint(320, 3));
		labelJoinTime.setSize(new IntDimension(105, 17));
		labelJoinTime.setPreferredSize(new IntDimension(105, 17));
		labelJoinTime.setText("label");
		
		//component layoution
		append(labelName);
		append(labelLevel);
		append(labelRace);
		append(labelDevote);
		append(labelJob);
		append(labelJoinTime);
		
		//component layoution
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setForeground(ASColor.WHITE);
		labelName.setFont(font);
		labelName.setTextFilters(new Array(filter));
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setFont(font);
		labelLevel.setTextFilters(new Array(filter));
		labelRace.setForeground(ASColor.WHITE);
		labelRace.setFont(font);
		labelRace.setTextFilters(new Array(filter));
		labelDevote.setForeground(ASColor.WHITE);
		labelDevote.setFont(font);
		labelDevote.setTextFilters(new Array(filter));
		labelJob.setForeground(ASColor.WHITE);
		labelJob.setFont(font);
		labelJob.setTextFilters(new Array(filter));
		labelJoinTime.setForeground(ASColor.WHITE);
		labelJoinTime.setFont(font);
		labelJoinTime.setTextFilters(new Array(filter));
		
		addEventListener(ClickCountEvent.CLICK_COUNT, onItemClickCount); 
		this.setClipMasked(false);
		addEventListener(AWEvent.FOCUS_LOST,onFucusLost);
	}
	static public var clickItem:PaneFactionBMineMembersItem = null;
	private function onItemClickCount(event:ClickCountEvent):void
	{   
		if(event.getCount() == 1)
		{   
			if(_item != null)
			{
				FrameFactionBMineMembersItemClick._item = _item;
				
				var point:IntPoint = AsWingUtils.getStageMousePosition();

				//FrameClickChar.show(point.x-FrameFaction._frame.x,point.y-FrameFaction._frame.y);
				
				//FrameFactionBMineMembersItemClick.show(this.parent as JPanel,x + height/2, y + height/2);
				FrameFactionBMineMembersItemClick.show(this.parent as JPanel,point.x-FrameFaction._frame.x-8,point.y-FrameFaction._frame.y-102);
				
				if(clickItem != null)
				{
					clickItem.setBorder(new EmptyBorder);
					clickItem = null;
				}
				clickItem = this;
				this.setBorder(new LineBorder(null,ASColor.YELLOW));
				return;
			}
		}   
		if(clickItem != null)
		{
			clickItem.setBorder(new EmptyBorder);
			clickItem = null;
		}
		FrameFactionBMineMembersItemClick.hide();
	}
	private function onFucusLost(e:Event):void
	{
		if(FrameFactionBMineMembersItemClick.isShowing() && FrameFactionBMineMembersItemClick._item == _item)
			FrameFactionBMineMembersItemClick.hide();
	}
	
	//_________getters_________
	private var _item:Object = null;
	public function set item(val:Object):void
	{
		_item = val;
		
		labelName.setText("");
		labelLevel.setText("");
		labelRace.setText("");
		labelDevote.setText("");
		labelJob.setText("");
		labelJoinTime.setText("");
		
		if(_item == null)
		{
			return;
		}
		labelName.setText(_item.m_szCharName);
		labelLevel.setText(_item.m_nLevel);
		labelRace.setText(_item.m_nRace);
		labelDevote.setText(_item.m_nDevote);
		labelJob.setText(FrameFaction.getJobName(_item.m_nJob));
		labelJoinTime.setText(_item.m_nJoinTime);
		
		pack();
		this.paintImmediately();
	}
	public function get item():Object
	{
		return _item;
	}
	//_________getters_________
	
	
}

/**
 * MyPaneClickItem
 */
class FrameFactionBMineMembersItemClick extends JFrame{
	
	//members define
	private var btn_job_up:JLabelButton;
	private var btn_job_down:JLabelButton;
	private var btn_transfer_master:JLabelButton;
	private var btn_kick:JLabelButton;
	private var btn_close:JLabelButton;
	
	/**
	 * MyPaneClickItem Constructor
	 */
	public function FrameFactionBMineMembersItemClick(){
		
		setResizable(false);
		setClosable(false);
		setDragable(false);
		setTitleBar(null);
		setBackgroundDecorator(null);
		//this.getTitleBar().setTitleEnabled(false);
		
		//component creation
		setSize(new IntDimension(70, 90));
		setPreferredSize(new IntDimension(70, 90));
		var layout0:BoxLayout = new BoxLayout();
		layout0.setAxis(AsWingConstants.VERTICAL);
		layout0.setGap(0);
		getContentPane().setLayout(layout0);
		
		btn_job_up = new JLabelButton();
		btn_job_up.setSize(new IntDimension(60, 90));
		btn_job_up.setText("升职");
		
		btn_job_down = new JLabelButton();
		btn_job_down.setLocation(new IntPoint(30, 0));
		btn_job_down.setSize(new IntDimension(30, 90));
		btn_job_down.setText("降职");
		
		btn_transfer_master = new JLabelButton();
		btn_transfer_master.setLocation(new IntPoint(0, 60));
		btn_transfer_master.setSize(new IntDimension(60, 30));
		btn_transfer_master.setText("转让帮主");
		
		btn_kick = new JLabelButton();
		btn_kick.setLocation(new IntPoint(0, 66));
		btn_kick.setSize(new IntDimension(60, 22));
		btn_kick.setText("踢出帮派");
		
		btn_close = new JLabelButton();
		btn_close.setLocation(new IntPoint(0, 72));
		btn_close.setSize(new IntDimension(60, 18));
		btn_close.setText("关闭");
		
		//component layoution
		getContentPane().append(btn_job_up);
		getContentPane().append(btn_job_down);
		getContentPane().append(btn_transfer_master);
		getContentPane().append(btn_kick);
		getContentPane().append(btn_close);
		
		
		btn_job_up.setForeground(ASColor.WHITE);
		btn_job_up.setRollOverColor(ASColor.YELLOW);
		btn_job_up.setPressedColor(ASColor.BLUE);
		btn_job_down.setForeground(ASColor.WHITE);
		btn_job_down.setRollOverColor(ASColor.YELLOW);
		btn_job_down.setPressedColor(ASColor.BLUE);
		btn_transfer_master.setForeground(ASColor.WHITE);
		btn_transfer_master.setRollOverColor(ASColor.YELLOW);
		btn_transfer_master.setPressedColor(ASColor.BLUE);
		btn_kick.setForeground(ASColor.WHITE);
		btn_kick.setRollOverColor(ASColor.YELLOW);
		btn_kick.setPressedColor(ASColor.BLUE);
		btn_close.setForeground(ASColor.WHITE);
		btn_close.setRollOverColor(ASColor.YELLOW);
		btn_close.setPressedColor(ASColor.BLUE);
		
		setBackgroundDecorator(new SolidBackground(new ASColor(0x0e3c3b,1.0)));
		
		btn_job_up.addActionListener(onBtnJobUp);
		btn_job_down.addActionListener(onBtnJobDown);
		btn_transfer_master.addActionListener(onBtnTransferMaster);
		btn_close.addActionListener(onBtnClose);
		btn_kick.addActionListener(onBtnKick);
	}
	private function onBtnClose(e:Event):void
	{
		//this.closeReleased();
		FrameFactionBMineMembersItemClick.hide();
	}
	
	private function onBtnKick(e:Event):void
	{
		FrameInfo.showMessageDialog("","是否将成员 "+_item.m_szCharName+" 踢出帮派?",onOptionKick,null,true,null,JOptionPane.YES|JOptionPane.NO);
	}
	private function onOptionKick(button:uint):void
	{
		if(button == JOptionPane.YES)
		{
			Client.getInstance().sendPacketLogic(1813,[int(_item.m_nCharId)]);
		}
		FrameFactionBMineMembersItemClick.hide();
	}
	private function onBtnJobUp(event:Event):void
	{   
		Client.getInstance().sendPacketLogic(1811,[int(_item.m_nCharId),int(0)]);
		FrameFactionBMineMembersItemClick.hide();
	}
	
	private function onBtnJobDown(event:Event):void
	{   
		Client.getInstance().sendPacketLogic(1811,[int(_item.m_nCharId),int(1)]);
		FrameFactionBMineMembersItemClick.hide();
	}
	
	private function onBtnTransferMaster(e:Event):void
	{
		FrameInfo.showMessageDialog("","是否转让帮主职位给 "+_item.m_szCharName+" ?",onOptionTransferMaster,null,true,null,JOptionPane.YES|JOptionPane.NO);
	}
	private function onOptionTransferMaster(button:uint):void
	{
		if(button == JOptionPane.YES)
		{
			Client.getInstance().sendPacketLogic(1812,[int(_item.m_nCharId)]);
		}
		FrameFactionBMineMembersItemClick.hide();
	}
	public static var _frame:FrameFactionBMineMembersItemClick = null;
	public static var _item:Object = null;
	public static function show(parent:JPanel,x:int,y:int):void
	{
		if(_frame == null)
		{
			_frame = new FrameFactionBMineMembersItemClick();
		}
		parent.addChild(_frame);
		_frame.show();
		parent.bringToTop(_frame);
		
		_frame.setLocationXY(x, y);
		
	}
	public static function hide():void
	{
		if(isShowing())_frame.hide();
		_item = null;
		
		if(PaneFactionBMineMembersItem.clickItem != null)
		{
			PaneFactionBMineMembersItem.clickItem.setBorder(new EmptyBorder);
			PaneFactionBMineMembersItem.clickItem = null;
		}
	}
	public static function isShowing():Boolean
	{
		return(_frame != null&& _frame.isShowing());
	}
	
}
/**
 * MyPaneFactionBMineTrends
 */
class PaneFactionBMineTrends extends JPanel{
	
	//members define
	private var txtTrends:JTextArea;
	
	/**
	 * MyPaneFactionBMineTrends Constructor
	 */
	public function PaneFactionBMineTrends(){
		//component creation
		setSize(new IntDimension(425, 284));
		setPreferredSize(new IntDimension(425, 284));
		var layout0:CenterLayout = new CenterLayout();
		setLayout(layout0);
		
		txtTrends = new JTextArea();
		txtTrends.setLocation(new IntPoint(0, 0));
		txtTrends.setSize(new IntDimension(425, 284));
		txtTrends.setPreferredSize(new IntDimension(425, 284));
		
		//component layoution
		append(txtTrends);
		
		
		var txtFormat:TextFormat = new TextFormat("宋体", 12, 0xffffff, false, false, false);
		txtTrends.setDefaultTextFormat(txtFormat);
		txtTrends.setBackgroundDecorator(null);
		txtTrends.filters = new Array(new GlowFilter(0x000000, 1, 2, 2, 2));
		txtTrends.setClipMasked(false);
		txtTrends.setOpaque(false);
		txtTrends.setEditable(false);

	}
	public function update():void
	{
		if(CharInfo.m_objFaction.m_arTrends == null)
			CharInfo.m_objFaction.m_arTrends = [];
		var textTrendsSelf:String = "";
		for each(var item:String in CharInfo.m_objFaction.m_arTrends)
		{
			textTrendsSelf += item +"<br>";
			txtTrends.setHtmlText(textTrendsSelf);
		}
		txtTrends.scrollToBottomLeft();
	}
	//_________getters_________
	
	public function getTxtTrends():JTextArea{
		return txtTrends;
	}
	
	
}

/**
 * MyPaneFactionBMineApplicant
 */
class PaneFactionBMineApplicant extends JPanel{
	
	//members define
	private var panelItems:JPanel;
	private var panelBCenter:JPanel;
	private var btnPrev:JButton;
	private var labelPage:JLabel;
	private var btnNext:JButton;
	
	/**
	 * MyPaneFactionBMineApplicant Constructor
	 */
	public function PaneFactionBMineApplicant(){
		//component creation
		setSize(new IntDimension(425, 284));
		setPreferredSize(new IntDimension(425, 284));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		panelItems = new JPanel();
		panelItems.setLocation(new IntPoint(0, 24));
		panelItems.setSize(new IntDimension(425, 230));
		panelItems.setPreferredSize(new IntDimension(425, 230));
		var layout1:GridLayout = new GridLayout();
		layout1.setRows(10);
		layout1.setColumns(1);
		layout1.setHgap(0);
		layout1.setVgap(0);
		panelItems.setLayout(layout1);
		
		panelBCenter = new JPanel();
		panelBCenter.setLocation(new IntPoint(160, 257));
		panelBCenter.setSize(new IntDimension(104, 24));
		panelBCenter.setPreferredSize(new IntDimension(104, 24));
		var layout2:FlowLayout = new FlowLayout();
		layout2.setAlignment(AsWingConstants.CENTER);
		layout2.setHgap(5);
		layout2.setVgap(0);
		layout2.setMargin(false);
		panelBCenter.setLayout(layout2);
		
		btnPrev = new JButton();
		btnPrev.setLocation(new IntPoint(-1, 0));
		btnPrev.setSize(new IntDimension(29, 24));
		btnPrev.setPreferredSize(new IntDimension(29, 24));
		btnPrev.setText("label");
		
		labelPage = new JLabel();
		labelPage.setLocation(new IntPoint(34, 3));
		labelPage.setSize(new IntDimension(36, 16));
		labelPage.setPreferredSize(new IntDimension(36, 16));
		labelPage.setText("label");
		
		btnNext = new JButton();
		btnNext.setLocation(new IntPoint(75, 0));
		btnNext.setSize(new IntDimension(29, 24));
		btnNext.setPreferredSize(new IntDimension(29, 24));
		btnNext.setText("label");
		
		//component layoution
		append(panelItems);
		append(panelBCenter);
		
		panelBCenter.append(btnPrev);
		panelBCenter.append(labelPage);
		panelBCenter.append(btnNext);
		
		//-------------------
		setImages();
		updatePage();
	}
	private var _mallItems:Array = new Array();
	public function setImages():void
	{
		btnPrev.setText("");
		btnNext.setText("");
		
		btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
		btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
		
		btnPrev.addActionListener(onBtnPrev);
		btnNext.addActionListener(onBtnNext);
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelPage.setForeground(ASColor.WHITE);
		labelPage.setFont(font);
		labelPage.setTextFilters(new Array(filter));
		
		for(var i:int = 0; i < _itemsPerPage; i++)
		{
			var item:PaneFactionBMineApplicantItem = new PaneFactionBMineApplicantItem;
			panelItems.append(item);
			_mallItems.push(item);
		}
	}
	public function update():void
	{
		updatePage();
	}
	private var _currentPageIndex:int = 0;
	private var _currentPageIndexAll:int = 0;
	private var _itemsPerPage:int = 10;
	public function updatePage():void
	{
		if(CharInfo.m_objFaction.m_arApplicants == null)
			CharInfo.m_objFaction.m_arApplicants = [];
		
		for each(var obj:Object in _mallItems)
		{
			obj.item = null;
		}
		var nIndex:int = 0;
		var nCount:int = 0;
		for each(var item:Object in CharInfo.m_objFaction.m_arApplicants)
		{
			nCount++;
			if(nCount <= _currentPageIndex*_itemsPerPage)
				continue;
			_mallItems[nIndex++].item = item;
			if(nIndex >= _itemsPerPage)
				break;
		}
		
		var nCount1:int = CharInfo.m_objFaction.m_arApplicants.length;
		_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
		btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
	}
	
	private function onBtnPrev(event:Event):void
	{
		_currentPageIndex--;
		if(_currentPageIndex < 0)
			_currentPageIndex = 0;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
	private function onBtnNext(event:Event):void
	{
		_currentPageIndex++;
		if(_currentPageIndex > _currentPageIndexAll-1)
			_currentPageIndex = _currentPageIndexAll-1;
		else
			updatePage();
		labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
	}
}

/**
 * MyPaneFactionBMineApplicantItem
 */
class PaneFactionBMineApplicantItem extends JPanel{
	
	//members define
	
	//members define
	private var labelName:JLabel;
	private var labelLevel:JLabel;
	private var labelRace:JLabel;
	private var labelApplicantTime:JLabel;
	private var btn_faction_refuse:JButton;
	private var btn_faction_agree:JButton;
	
	/**
	 * MyPaneFactionBMineApplicantItem Constructor
	 */
	public function PaneFactionBMineApplicantItem(){
		//component creation
		//component creation
		setSize(new IntDimension(425, 23));
		setPreferredSize(new IntDimension(425, 23));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(0, 3));
		labelName.setSize(new IntDimension(89, 17));
		labelName.setPreferredSize(new IntDimension(89, 17));
		labelName.setText("label");
		
		labelLevel = new JLabel();
		labelLevel.setLocation(new IntPoint(90, 3));
		labelLevel.setSize(new IntDimension(43, 17));
		labelLevel.setPreferredSize(new IntDimension(43, 17));
		labelLevel.setText("label");
		
		labelRace = new JLabel();
		labelRace.setLocation(new IntPoint(134, 3));
		labelRace.setSize(new IntDimension(43, 17));
		labelRace.setPreferredSize(new IntDimension(43, 17));
		labelRace.setText("label");
		
		labelApplicantTime = new JLabel();
		labelApplicantTime.setLocation(new IntPoint(178, 3));
		labelApplicantTime.setSize(new IntDimension(121, 17));
		labelApplicantTime.setPreferredSize(new IntDimension(121, 17));
		labelApplicantTime.setText("label");
		
		btn_faction_refuse = new JButton();
		btn_faction_refuse.setLocation(new IntPoint(312, 0));
		btn_faction_refuse.setSize(new IntDimension(46, 23));
		btn_faction_refuse.setPreferredSize(new IntDimension(46, 23));
		btn_faction_refuse.setText("label");
		
		btn_faction_agree = new JButton();
		btn_faction_agree.setLocation(new IntPoint(368, 0));
		btn_faction_agree.setSize(new IntDimension(46, 23));
		btn_faction_agree.setPreferredSize(new IntDimension(46, 23));
		btn_faction_agree.setText("label");
		
		//component layoution
		append(labelName);
		append(labelLevel);
		append(labelRace);
		append(labelApplicantTime);
		append(btn_faction_refuse);
		append(btn_faction_agree);
		
		//component layoution
		
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setForeground(ASColor.WHITE);
		labelName.setFont(font);
		labelName.setTextFilters(new Array(filter));
		labelLevel.setForeground(ASColor.WHITE);
		labelLevel.setFont(font);
		labelLevel.setTextFilters(new Array(filter));
		labelRace.setForeground(ASColor.WHITE);
		labelRace.setFont(font);
		labelRace.setTextFilters(new Array(filter));
		labelApplicantTime.setForeground(ASColor.WHITE);
		labelApplicantTime.setFont(font);
		labelApplicantTime.setTextFilters(new Array(filter));
		
		btn_faction_refuse.wrapSimpleButton(Client.getUIElement("btn_faction_refuse") as SimpleButton);
		btn_faction_refuse.setText("");
		btn_faction_agree.wrapSimpleButton(Client.getUIElement("btn_faction_agree") as SimpleButton);
		btn_faction_agree.setText("");
		btn_faction_refuse.addActionListener(onBtnFactionRefuse);
		btn_faction_agree.addActionListener(onBtnFactionAgree);
	}
	private function onBtnFactionRefuse(e:Event):void
	{
		if(_item == null)
			return;
		Client.getInstance().sendPacketLogic(1806,[int(_item.m_nCharId),int(0)]);
	}
	private function onBtnFactionAgree(e:Event):void
	{
		if(_item == null)
			return;
		Client.getInstance().sendPacketLogic(1806,[int(_item.m_nCharId),int(1)]);
	}
	//_________getters_________
	private var _item:Object = null;
	public function set item(val:Object):void
	{
		_item = val;
		labelName.setText("");
		labelLevel.setText("");
		labelRace.setText("");
		labelApplicantTime.setText("");
		btn_faction_refuse.setVisible(false);
		btn_faction_agree.setVisible(false);
		if(_item == null)
		{
			return;
		}
		labelName.setText(_item.m_szCharName);
		labelLevel.setText(_item.m_nLevel);
		labelRace.setText(_item.m_nRace);
		labelApplicantTime.setText(_item.m_nApplicantTime);
		btn_faction_refuse.setVisible(true);
		btn_faction_agree.setVisible(true);
		pack();
		this.paintImmediately();
	}
	public function get item():Object
	{
		return _item;
	}
	//_________getters_________
	
	
}